package sis.report;
import sis.studentinfo.CourseSession;
import sis.studentinfo.Session;

import java.util.ArrayList;
import java.util.Collections;
/*
 * @auther 顶风少年
 * @mail dfsn19970313@foxmail.com
 * @date 2019-07-21 15:53
 * @notify 课程报告
 * @version 1.0
 */

public class CourseReport {
    //存储课程
    private ArrayList<Session> sessions = new ArrayList<>();

    //对外提供增加课程方法
    public void add(Session courseSession){
        sessions.add(courseSession);
    }

    //打印课程信息
    public String text(){
        //对课程进行排序
        Collections.sort(sessions);
        StringBuilder stringBuilder = new StringBuilder();
        for(Session courseSession:sessions){
            //打印课程系和课程编号
            stringBuilder.append(courseSession.getDepartment()+" "+courseSession.getNumber()+RosterReporter.NEWLINE);
        }
        return stringBuilder.toString();
    }
}
